package com.lwm.killer.redis;

public  abstract   class BasePrefix implements KeyPrefix {

    private int expireSeconds;
    private String prefix;

    public BasePrefix(int expireSeconds, String prefix) {
        this.expireSeconds = expireSeconds;
        this.prefix = prefix;
    }

    public BasePrefix(String prefix) {
        this(0,prefix);
    }


    @Override
    public int expireSeconds() {  //默认0为永不过期
        return expireSeconds;
    }

    @Override
    public String getPrefix() {  //key前缀
        String className = getClass().getSimpleName();
        return  className+":"+prefix;
    }
}
